package org.testis.testdriver.validation;

import org.testis.testdriver.*;
import org.testis.testdriver.AtofEnumaration.AtofLogLevel;


/**
 * This class is used to make validation according to PreConditionCase 
 * Startegy.
 * 
 * @author barisergun
 */
public class TestPartValidatePreConditionCaseStrategy extends TestPartValidateStrategy
{

    public TestPartValidatePreConditionCaseStrategy(TestPart inUse)
    {
        super(inUse);
    }


    @Override
    protected boolean validateIfToContinue(boolean partResult)
    {
        if (testPartInRun.getTestPartResult() == false) {
            testPartInRun.getParent().andTestPartResult(partResult);
            NotificationSubjectSingleton.getInstance().notifyLogMessages(
                testPartInRun.getPartName(),
                AtofLogLevel.INFO,
                " failed so skipping following Test Cases included in the " +
                testPartInRun.getParent().getPartName(),
                testPartInRun.getPartGuid());
            return false;
        }
        else {

            testPartInRun.getParent().andTestPartResult(testPartInRun.
                getTestPartResult());
            return true;


        }

    }


    
}
